package com.caimiao.miao.library.utils.storage;

import android.content.Context;
import android.content.SharedPreferences;

import com.caimiao.miao.MiaoApplication;

public class PrefUtil {
    private static final String NAME = "miao";

    private static class Holder {
        private static final SharedPreferences pref = MiaoApplication.getContext().getSharedPreferences(NAME, Context.MODE_PRIVATE);
    }


    public static void saveBaseUrl(String baseUrl) {
        Holder.pref.edit().putString("BASEURL", baseUrl).commit();
    }

    public static String getBaseUrl() {
        return Holder.pref.getString("BASEURL", null);
    }

    //设备注册状态
    public static void setInitDevice(boolean state) {
        Holder.pref.edit().putBoolean("INIT_DEVICE", state).commit();
    }

    //设备是否向服务器注册过
    public static boolean isInitDevice() {
        return Holder.pref.getBoolean("INIT_DEVICE", false);
    }
}
